<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:c="http://xmlns.jcp.org/jsf/composite"
	xmlns:p="http://primefaces.org/ui">

<ui:decorate template="/jsp/WEB/pageLayout.xhtml">

	<ui:define name="centro">
		<h:form id="form">
			<p:growl id="msgs" showDetail="true" />

			<!-- *********************************************************************** -->
			<!-- Painel Localizar-->
			<!-- *********************************************************************** -->
			<p:panel id="localizar" header="Localizar Pos"
				toggleable="true" toggleSpeed="500" collapsed="true"
				widgetVar="panel" style="margin-bottom:20px">
				<h:panelGrid id="gridFindPos" columns="5"
					style="border:0px">
					
					<h:outputText value="Serial: " />
					<p:inputText id="serial" value="#{CadPos.posSerialFind}" />

					<p:commandButton id="searchButton" image="ui-icon-search"
						update="@cadPos" ajax="false"
						title="Localizar Pos"
						actionListener="#{CadPos.find}" />
				</h:panelGrid>
			</p:panel>


			<!-- *********************************************************************** -->
			<!-- Painel Cadastrar-->
			<!-- *********************************************************************** -->
			<p:panel id="Cadastrar" header="Cadastrar POS">

				<br />

				<h:panelGrid id="cadPos" columns="2">

					<h:outputText value="Estabelecimento: " />
					<p:selectOneMenu value="#{CadPos.idEstab}" style="width:150px">
						<f:selectItems value="#{CadPos.estabelecimentos}" var="est"
							itemLabel="#{est.razaoSocial}"
							itemValue="#{est.idEstabelecimento}" />
					</p:selectOneMenu>

					<h:outputLabel for="serie" value="Serie POS: " />
					<p:inputText id="valor" label="Valor" required="true" 
						requiredMessage="Preencha o campo serial"
						value="#{CadPos.posSerial}" />

					<br />
				</h:panelGrid>

				<p:separator />

				<!-- *********************************************************************** -->
				<!-- Botoes-->
				<!-- *********************************************************************** -->
				<p:commandButton id="salvar" value="Salvar" update="form"
					icon="ui-icon-disk" actionListener="#{CadPos.save}" ajax="false"
					oncomplete="handleLoginRequest(xhr, status, args)" />

				<p:commandButton id="excluir" value="Excluir"
					action="#{CadPos.delete}" icon="ui-icon-minus" />

				<p:commandButton id="limpar" value="Limpar" update="@form"
					action="#{CadPos.refresh}" icon="ui-icon-document"
					resetValues="true" />

			</p:panel>
		</h:form>

	</ui:define>
</ui:decorate>
</html>